package com.yang.SpringTest.annotation.scopeLearn;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * <p>ScopeDemoConfig配置类</p>
 *
 * @author By: chengxuyuanshitang
 * Package com.yang.SpringTest.annotation.scopeLearn
 * Ceate Time 2024-04-09 17:08
 */
@Configuration
@ComponentScan(value = {"com.yang.SpringTest.annotation.scopeLearn"})
public class ScopeDemoConfig {
    @Bean
    @Scope(value = "singleton")
    public ScopePrototypeDemo scopePrototypeDemo () {
        return new ScopePrototypeDemo ();
    }

    @Bean
    @Scope(value = "prototype")
    public ScopeSingletonDemo scopeSingletonDemo () {
        return new ScopeSingletonDemo ();
    }
}

